package com.gf.user.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.gf.base.controller.BasicController;
import com.gf.common.constant.ViewPaths;
import com.gf.user.dao.UserBaseDao;
import com.gf.user.model.User;

/**
 * 
 * @author zhuguifeng
 * 
 */
@Controller
@RequestMapping("/base")
public class UserBaseController extends BasicController {

	@Autowired
	private UserBaseDao userBaseDao;

	@RequestMapping(value = "/login", method = RequestMethod.GET)
	public ModelAndView loginRequest() {
		ModelAndView mvc = new ModelAndView();
		mvc.addObject("sysInfo", "欢迎回来");
		mvc.setViewName(ViewPaths.LOGIN_VIEW);
		return mvc;
	}

	@RequestMapping(value = "/login", method = RequestMethod.POST)
	public ModelAndView loginExcute(String username, String passwd) {
		User user = new User(username, passwd);
		// userBaseDao.save(user);

		ModelAndView mvc = new ModelAndView();
		mvc.addObject("sysInfo", "保存成功");
		mvc.setViewName(ViewPaths.LOGIN_VIEW);
		return mvc;
	}

}
